﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.Rendering.SortingLayerRange
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System;

#nullable disable
namespace UnityEngine.Rendering
{
  /// <summary>
  ///   <para>Describes a renderer's sorting layer range.</para>
  /// </summary>
  /// <summary>
  ///   <para>Sets the inclusive range for a sorting layer object.</para>
  /// </summary>
  /// <param name="lowerBound">Lowest sorting layer value to include.</param>
  /// <param name="upperBound">Highest sorting layer value to include.</param>
  public struct SortingLayerRange(short lowerBound, short upperBound) : IEquatable<SortingLayerRange>
  {
    private short m_LowerBound = lowerBound;
    private short m_UpperBound = upperBound;

    /// <summary>
    ///   <para>Inclusive lower bound for the range.</para>
    /// </summary>
    public short lowerBound
    {
      get => this.m_LowerBound;
      set => this.m_LowerBound = value;
    }

    /// <summary>
    ///   <para>Inclusive upper bound for the range.</para>
    /// </summary>
    public short upperBound
    {
      get => this.m_UpperBound;
      set => this.m_UpperBound = value;
    }

    /// <summary>
    ///   <para>A range that includes all objects.</para>
    /// </summary>
    public static SortingLayerRange all
    {
      get
      {
        return new SortingLayerRange()
        {
          m_LowerBound = short.MinValue,
          m_UpperBound = short.MaxValue
        };
      }
    }

    public bool Equals(SortingLayerRange other)
    {
      return (int) this.m_LowerBound == (int) other.m_LowerBound && (int) this.m_UpperBound == (int) other.m_UpperBound;
    }

    public override bool Equals(object obj) => obj is SortingLayerRange other && this.Equals(other);

    public static bool operator !=(SortingLayerRange lhs, SortingLayerRange rhs)
    {
      return !lhs.Equals(rhs);
    }

    public static bool operator ==(SortingLayerRange lhs, SortingLayerRange rhs) => lhs.Equals(rhs);

    public override int GetHashCode()
    {
      return (int) this.m_UpperBound << 16 | (int) this.m_LowerBound & (int) ushort.MaxValue;
    }
  }
}
